<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script>
			//回调函数
			function p1(){
				console.log("111");
			}
			setTimeout(p1(),3000);
			
			//异步 AJAX
			var xhr = new XMLHttpRequest();
			
			xhr.onload =function(){
				//打印接收到的文字
				console.log(xhr.responseText);
			}
			
			xhr.onerror = function(){
				//出现异常
				console.error('请求出错');
			}
			
			xhr.open("GET","http://www.baidu.com",true);
			xhr.send();
		</script>
	</body>
</html>